package com.jctrip.hotel.source.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.jctrip.hotel.source.model.Result;
import com.jctrip.hotel.source.model.hworld.req.*;
import com.jctrip.hotel.source.model.hworld.resp.HworldHotelInfo;
import com.jctrip.hotel.source.model.hworld.resp.HworldQueryUserResp;
import com.jctrip.hotel.source.model.hworld.resp.HworldResult;
import com.jctrip.hotel.source.service.hworld.HworldH5Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author：Haruhi
 * @description:
 * @Date：2023/12/28 15:14
 * @Package：com.jctrip.hotel.source.controller
 * @Project：hotel-main
 */
@Slf4j
@Api(tags = "华住商旅H5接口")
@RestController
@RequestMapping("/hworldh5")
public class HworldH5Controller {
    @Resource
    private HworldH5Service hworldH5Service;

    @PostMapping("/addUser")
    @ApiOperation(value = "新增员工", notes = "新增员工")
    public Result addUser(@RequestBody HworldAddUserReq req) {
        Boolean result;
        try {
            result = hworldH5Service.addUser(req);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok(result);
    }

    @PostMapping("/modifyUser")
    @ApiOperation(value = "员工信息修改", notes = "员工信息修改")
    public Result modifyUser(@RequestBody HworldModifyUserReq req) {
        Boolean result;
        try {
            result = hworldH5Service.modifyUser(req);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok(result);
    }

    @PostMapping("/deleteUser")
    @ApiOperation(value = "员工信息删除", notes = "员工信息删除")
    public Result modifyUser(@RequestBody HworldDeleteUserReq req) {
        Boolean result;
        try {
            result = hworldH5Service.deleteUser(req);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok(result);
    }

    @PostMapping("/queryUser")
    @ApiOperation(value = "员工信息查询", notes = "员工信息查询")
    public Result queryUser(@RequestBody HworldQueryUserReq req) {
        HworldQueryUserResp result;
        try {
            result = hworldH5Service.queryUser(req);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok(result);
    }

}
